package com.guoxin.thread.stop;

/**
 * @author guoxin
 * @date 2019/6/28
 */
public class MainThread {
    public static void main(String[] args) throws InterruptedException {
        StopThread stopThread = new StopThread();
        StopThread stopThread1 = new StopThread();
        stopThread.start();
        stopThread1.start();
        for (int i = 0; i < 30; i++) {
            Thread.sleep(10);
            System.out.println(Thread.currentThread().getName() + "--" + i);
            if (i == 29) {
                stopThread.interrupt();
                stopThread1.interrupt();
            }
        }
    }
}
